class Solution
{
public:
    int minTimeToVisitAllPoints(vector<vector<int>> &points)
    {
        auto mhtDist = [](auto &p1, auto &p2)
        {
            return max(abs(p1[0] - p2[0]), abs(p1[1] - p2[1]));
        };
        int n = points.size();
        int time = 0;
        for (int i = 1; i < n; ++i)
        {
            time += mhtDist(points[i], points[i - 1]);
        }
        return time;
    }
};